home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
CDROM
/
CD-Finder
/
CD-Finder_demo.p
< prev
next >
Wrap
Text File
|
1997-11-23
|
50KB
|
1,627 lines
; CD-Finder
;
; (c) 1997 Cyborg
{* Include sys:coder/preass/Options.p *}
{* Include sys:coder/preass/Prozeduren.p *}
Include sys:coder/include/Datatypes/datatypes.i
Include sys:coder/include/intuition/icclass.i
{* NewProc=TerminateString[Buffer][A0]*}
{* NewProc=Export[][]*}
{* NewProc=DirTree[][]*}
{* NewProc=DrawTree_SUB[][a2]*}
{* IncSysBlock: IndexNodeSpeicher,5024*}
{* IncSysBlock: SelectedNodeSpeicher,5024*}
{* IncSysBlock: IndexItems,1024*}
{* IncSysBlock: FIB,300*}
{* IncBlock: Buffer,1000*}
{* IncBlock: Buffer1,100*}
{* IncBlock: CDName,50*}
{* IncVar: IndexNodeZeiger,Files1,Files,Dirs1,Dirs,Von*}
{* Array[Long]: Cycle_labs,Pipe_Lab,Kcon_lab,PRT_Lab,File_lab*}
{* Array[Long]: Dateitype_Labs,ASCII,CVS_TAB,CVS_SPACE,CVS_SEMI,CVS_Komma,SYLK,Lotus*}
{* String: Pipe_Lab="Pipe:Export"*}
{* String: KCON_Lab="KCON:"*}
{* String: PRT_Lab="PRT:"*}
{* String: File_Lab="File:"*}
{* String: ASCII="Nur Text"*}
{* String: CVS_Tab="CVS Tab"*}
{* String: CVS_Space="CVS Space"*}
{* String: CVS_Semi="CVS ;"*}
{* String: CVS_Komma="CVS ,"*}
{* String: SYLK="Sylk Excel-4+"*}
{* String: Lotus="Lotus 1-2-3"*}
{* String: Version="$VER: CD-Finder 1.1 DEMOVersion (C) CYBORG 97"*}
{* String: DoItText="Ja|Nein|Neuer Name"*}
{* InitMinList: Index_Labs*}
{* InitMinList: Selected_Labs*}
Eintraglaenge= 32
SECTION A,DATA
even
TopazAttr:
dc.l TopazName
dc.w 8
dc.b 0,0
Topazname:
dc.b "topaz.font",0
blk.b 29,0
SECTION B,CODE
AminetCheck[D7]:
Read(D7,#Buffer,1)
Seek(D7,#-1,#Offset_Current)
cmpi.b #"|",Buffer
beq .Aminet
move.l #-1,d0
RTS
.aminet:
Result=Fgets(Handle,#Buffer,1000)
If Result##Buffer -> .ende
cmpi.b #"|",buffer
beq .aminet
.Schleife:
Result=Fgets(Handle,#Buffer,1000)
If Result##Buffer -> .ende
move.l buffer,a0
.l1:cmpi.b #" ",(a0)+
bne .l1
lea -1(a0),a1
.l2:cmpi.b #" ",(a0)+
beq .l2
lea -1(a0),a2
.l3:cmpi.b #" ",(a0)+
bne .l3
lea -1(a0),a3
move.l a3,d3
sub.l a2,d3
move.l a1,d2
sub.l #Buffer,d2
movem.l d0-d3/a0-a3,-(a7)
Copymem(a2,#Buffer1,d3)
movem.l (a7)+,d0-d3/a0-a3
FIB=="AMINET:"+Left$(Buffer1,d3)+"/"+Left$(Buffer,d2)+"\n"
OK=Countstring(#FIB)
Write(WH,#FIB,OK)
beq .Schleife
.ende:
moveq.l #0,d0
RTS
Prefs[]:
IndexWindow=OpenGuiWindowA(000,011,300,110,"CD-Finder Prefs",
#IDCMP_GADGETDOWN!IDCMP_GADGETUP!IDCMP_CLOSEWINDOW!IDCMP_IDCMPupdate,
#WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_RMBTRAP!0,0,0)
Checkf IndexWindow,WaitMessage
IndexGUI=CreateGuiInfoA(IndexWindow,0)
CreateGuiGadgetA(IndexGui,10,10,200,013,#CheckBox_Kind,
>GadgetP00Tags:GEG_Description,0|
GEG_Text,GadgetP00Text="Suche in einem File"|
GEG_Flags,002|
Tag_done,0)
{* IncVar: SearchOnly*}
CreateGuiGadgetA(IndexGui,10,25,200,013,#CheckBox_Kind,
>GadgetP01Tags:GEG_Description,0|
GEG_Text,GadgetP01Text="Anzeige beim Scannen"|
GEG_Flags,002|
Tag_done,0)
DrawGuiA(IndexGui,0)
.WaitMessage:
{* Flush *}
WaitGuiMsg(IndexGui)
MsgClass=.l36(IndexGui)
If MsgClass##IDCMP_CloseWindow --> .WaitMessage
CloseGuiWindow(IndexWindow)
RTS
Cnop 0,4
Open_Window:
Window=OpenGuiWindowA(000,011,640,50,"CD-Finder",
#IDCMP_GADGETDOWN!IDCMP_GADGETUP!IDCMP_CLOSEWINDOW!IDCMP_VANILLAKEY!IDCMP_RAWKEY!0,
#WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_RMBTRAP!0,0,0)
Checkf Window,Open_Windowende
GUI=CreateGuiInfoA(Window,0)
Open_Windowende:RTS
Create_Gadgets:
CreateGuiGadgetA(Gui,070,005,100,012,#String_Kind,
>Gadget000Tags:GEG_Description,0|
GEG_Text,GADGET000Text="_Device:"|
GEG_Flags,001|
GEG_Varaddress,Device|
Tag_done,0)
{* IncSysBlock: Device,100*}
CreateGuiGadgetA(Gui,005,020,080,012,#Button_Kind,
>Gadget001Tags:GEG_Description,0|
GEG_Text,GADGET001Text="S_can"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,090,020,080,012,#Button_Kind,
>Gadget002Tags:GEG_Description,0|
GEG_Text,GADGET002Text="_Edit"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,175,020,080,012,#Button_Kind,
>Gadget003Tags:GEG_Description,0|
GEG_Text,GADGET003Text="_Suche"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,230,005,400,012,#String_Kind,
>Gadget004Tags:GEG_Description,0|
GEG_Text,GADGET004Text="_Text"|
GEG_Flags,001|
GEG_Varaddress,SuchText|
Tag_done,0)
{* IncSysBlock: SuchText,100*}
CreateGuiGadgetA(Gui,260,020,127,012,#Button_Kind,
>Gadget005Tags:GEG_Description,0|
GEG_Text,GADGET005Text="_Importieren"|
GEG_Flags,048|
Tag_done,0)
CreateGuiGadgetA(Gui,390,020,240,06,#GEG_ProgressIndicatorKind,
>Gadget006Tags:GEG_Description,0|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,390,027,240,06,#GEG_ProgressIndicatorKind,#Gadget006Tags)
{* IncVar: Pro*}
CreateGuiGadgetA(Gui,005,034,080,012,#Button_Kind,
>Gadget008Tags:GEG_Description,0|
GEG_Text,GADGET008Text="I_ndex"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,090,034,080,012,#Button_Kind,
>Gadget009Tags:GEG_Description,0|
GEG_Text,GADGET009Text="In_fo"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,260,034,127,012,#Button_Kind,
>Gadget010Tags:GEG_Description,0|
GEG_Text,GADGET010Text="E_xportieren"|
GEG_Flags,048|
Tag_done,0)
CreateGuiGadgetA(Gui,175,034,080,012,#Button_Kind,
>Gadget011Tags:GEG_Description,0|
GEG_Text,GADGET011Text="T_ree"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(Gui,390,034,080,012,#Button_Kind,
>Gadget012Tags:GEG_Description,0|
GEG_Text,GADGET012Text="_Prefs"|
GEG_Flags,016|
Tag_done,0)
Result=DrawGuiA(Gui,0)
RTS
Close_Window:
CloseGuiWindow(Window)
RTS
WritePlain[d7]:
Convertzahl(D7,0)
Zeiger==#Zusatz
Anz==8
.Write_Sylk_test1:
Wert=.b(Zeiger)
cmpi.l #$00000020,Wert
bne .Write_Sylk_Test2
Zeiger==Zeiger++
Anz==Anz--
bra .Write_Sylk_test1
.Write_Sylk_test2:
Write(WH,Zeiger,anz)
RTS
CountCells[a0]:
moveq.l #0,d0
.count:
lea 1(a0),a0
addq.l #1,d0
.CountCells1:
cmpi.b #`:`,(a0)
beq .count
cmpi.b #`/`,(a0)
beq .Count
cmpi.b #$0a,(a0)
beq .ende
cmpi.b #$00,(a0)
beq .ende
lea 1(a0),a0
bra .CountCells1
.ende:
RTS
WriteZelle[a0,d1]:
moveq.l #0,d0
.count:
addq.l #1,d0
cmpi.l d0,d1
beq .write
lea 1(a0),a0
.CountCells1:
cmpi.b #`:`,(a0)
beq .count
cmpi.b #`/`,(a0)
beq .Count
lea 1(a0),a0
bne .CountCells1
.Write:
cmpi.l #1,d1
beq .write0
lea 1(a0),a0
.write0:
move.l a0,a1
.weiter:
cmpi.b #`:`,(a0)
beq .next
cmpi.b #`/`,(a0)
beq .next
cmpi.b #$0a,(a0)
beq .next
cmpi.b #$00,(a0)
beq .next
lea 1(a0),a0
bra .weiter
.next:
sub.l a1,a0
Write(WH,a1,a0)
RTS
TestFilename[D7,a0]:
NamefromFH(D7,#Buffer,1000)
Seek(D7,0,#Offset_end)
Laenge=Seek(d7,0,#Offset_begin)
Memoryblock=AllocMem(Laenge,#MEMF_CLEAR!MEMF_PUBLIC)
CheckF MemoryBlock,.error
Read(d7,Memoryblock,Laenge)
Move.l Memoryblock,d0
RTS
.Error:
Moveq.l #0,d0
RTS
{* NewProc=TerminateString[Buffer][A0]*}
TerminateString:
move.l a0,-(a7)
.l1:cmpi.b #$00,(a0)
beq .ende
cmpi.b #$0a,(a0)
beq .Term
lea 1(a0),a0
bra.s .l1
.Term:
move.b #$00,(a0)
.ende:
move.l (a7)+,a0
RTS
RGets[A0]:
TerminateString(a0)
move.l memoryblock,a1
add.l Laenge,a1
cmp.l a0,a1
ble .error
moveq.l #1,d0
RTS
.error:
moveq.l #0,d0
RTS
RGets2[A0]:
OK=Countstring(a0)
move.l a0,a1
add.l Ok,a1
addi.l #1,a1
move.l memoryblock,a0
add.l len,a0
cmpa.l a0,a1
bge .l1
move.l a1,d0
RTS
.l1:
moveq.l #0,d0
RTS
Progress[Gadget,Prozent]:
{* IncVar: Prozent,Gadget*}
Lea SetProgressTags,a0
move.l Prozent,4(a0)
SetGUIGadgetA(gui,Gadget,>SetProgressTags:GEG_PICurrentValue,0|
Tag_Done,NULL)
RTS
Copy[d6,d7]:
anz=Read(d6,#Buffer,1000)
anz=Write(d7,#Buffer,anz)
If Anz=#1000 --> Copy
RTS
SetPfad[]:
FPuts(TH,#Pfad)
OK=CountString(#pfad)
Lea PFad,a0
add.l ok,a0
.l1:cmpi.b #"/",(a0)
beq .Thatsit
cmpi.b #":",(a0)
beq .Thatsit
lea -1(a0),a0
bra .l1
.ThatsIt:
move.b #0,1(a0)
OK=CountString(#pfad)
RTS
SetPfad_Crunch[]:
FPuts(TH,#Pfad)
OK=CountString(#pfad)
WriteLaenge==Writelaenge+OK
ReadLaenge==Readlaenge+OK
Lea PFad,a0
add.l ok,a0
.l1:cmpi.b #"/",(a0)
beq .Thatsit
cmpi.b #":",(a0)
beq .Thatsit
lea -1(a0),a0
bra .l1
.ThatsIt:
lea 1(a0),a0
move.b #0,(a0)+
RTS
SetPfad_Compare[]:
OK=CountString(#pfad2)
Lea PFad2,a0
add.l ok,a0
.l1:cmpi.b #"/",(a0)
beq .Thatsit
cmpi.b #":",(a0)
beq .Thatsit
lea -1(a0),a0
bra .l1
.ThatsIt:
lea 1(a0),a0
move.b #0,(a0)+
RTS
ComparePfad[a0,a1]:
move.b (a0)+,d0
move.b (a1)+,d1
cmpi.b d0,d1
bne .dismatch
cmpi.b #0,(a0)
bne ComparePfad
moveq.l #-1,d0
RTS
.dismatch:
moveq.l #0,d0
RTS
Crunch[Handle]:
Progress(6,50)
Counter==Counter*2
Count==0
ReadLaege==0
Writelaenge==0
Move.l Handle,-(a7)
Move.l TH,-(a7)
Move.l OK,-(a7)
Move.l Result,-(a7)
Handle=Open(Handle,#Mode_old)
TH=Open("t:swap.crunch",#mode_new)
Write(TH,"CM01\n",5)
Result=Fgets(Handle,#Pfad,150)
If Result##Pfad -> .ende
.l0:
SetPfad_Crunch()
Copymem(#pfad,#Pfad_1,150)
.l1:
Pro==Writelaenge*100
Pro==Pro/ReadLaenge
Progress(7,Pro)
Count==Count+1
Pro==Count*100
Pro==Pro/Counter
Pro==Pro+50
Progress(6,Pro)
Result=Fgets(Handle,#Pfad,150)
If Result##Pfad -> .ende1
OK=Countstring(#Pfad)
Readlaenge==Readlaenge+ok
Copymem(#pfad,#Pfad2,150)
SetPfad_Compare()
Match=ComparePfad(#Pfad2,#Pfad_1)
CheckF Match,.l0
Fwrite(TH,"%",1,1)
OK=Countstring(#Pfad)
lea pfad,a0
add.l ok,a0
.l2:cmpi.b #"/",(a0)
beq .Thatsit
cmpi.b #":",(a0)
beq .Thatsit
lea -1(a0),a0
bra .l2
.ThatsIt:
lea 1(a0),a0
move.l a0,Result
OK=Countstring(Result)
Fwrite(TH,Result,ok,1)
OK==OK+1
WriteLaenge==Writelaenge+OK
bra .l1
.ende1:
Seek(TH,0,#Offset_begin)
NamefromFH(Handle,#pfad,150)
Close(Handle)
Handle=Open(#Pfad,#Mode_new)
Copy(TH,Handle)
Close(TH)
Close(handle)
Deletefile("T:swap.crunch")
bra .ende2
.Ende:
Close(TH)
Close(handle)
.ende2:
Move.l (a7)+,Result
Move.l (a7)+,OK
Move.l (a7)+,TH
Move.l (a7)+,Handle
Progress(6,100)
RTS
Decrunch[Handle]:
{* IncsysBlock: Pfad,150*}
{* IncsysBlock: Pfad_1,150*}
{* IncsysBlock: Pfad2,150*}
{* IncVar: Handle*}
Countfiles==1
CountDirs==1
MaxZellen==0
Move.l Handle,-(a7)
Move.l TH,-(a7)
Move.l OK,-(a7)
Move.l Result,-(a7)
move.l handle,a0
move.l (a0),Handle
Fgets(Handle,#Pfad,150)
If Pfad##"CM01" --> .Ende
TH=Open("t:swap.decrunch",#mode_new)
Result=Fgets(Handle,#Pfad,150)
If Result##Pfad -> .ende
bra .l0
.l00:
CopyMem(#Pfad_1,#Pfad,150)
.l0:
Countdirs==Countdirs++
SetPfad()
.l1:
Result=Fgets(Handle,#Pfad_1,150)
If Result##Pfad_1 -> .ende1
Zellen=CountCells(#pfad_1)
If Zellen>maxZellen {
maxZellen==Zellen
}
Countfiles==Countfiles++
Cmpi.b #"%",pfad_1
bne .l00
FWrite(TH,#Pfad,OK,1)
FPuts(TH,#Pfad_1+1)
bra .l1
.ende1:
Close(Handle)
move.l TH,D7
Seek(D7,0,#Offset_Begin)
Move.l (a7)+,Result
Move.l (a7)+,OK
Move.l (a7)+,TH
Move.l (a7)+,a0
move.l D7,(a0)
RTS
.ende:
Seek(Handle,0,#Offset_Begin)
Move.l (a7)+,Result
Move.l (a7)+,OK
Move.l (a7)+,TH
Move.l (a7)+,Handle
RTS
Progressfiles[]:
{* IncVar: Merker*}
Counter==Counter+1
Files==Files+1
If Files<#10 --> .ende
Files==0
Merker==Merker+1
If Merker<#101 --> .l1
Merker==0
.l1:
Lea SetProgressTags,a0
move.l Merker,4(a0)
SetGUIGadgetA(gui,7,#SetProgressTags)
.ende:
RTS
ProgressReadlines[]:
Counter==Counter+1
If Counter<#10 --> .ende
Counter==0
Merker==Merker+1
If Merker<#101 --> .l1
Merker==0
.l1:
Lea SetProgressTags,a0
move.l Merker,4(a0)
SetGUIGadgetA(gui,7,#SetProgressTags)
.ende:
RTS
GetCDName[a0]
Dirlock=Lock(a0,#Access_read)
NameFromLock(Dirlock,#CDName,100)
CheckF Dirlock,.ende
Unlock(Dirlock)
.ende:
RTS
GetIndex[]:
Zahl==0
Dirlock=Lock("Base-CD:",#access_read)
FillBuffer(#Fib,0,300)
Examine(Dirlock,#FIB)
.Schleife:
Zahl==Zahl+1
OK=ExNext(Dirlock,#FIB)
CheckT Ok,.Schleife
Unlock(Dirlock)
move.l Zahl,d0
RTS
Anhaengen[]:
Result=GuiRequestA(Gui,"Schon vorhanden anhängen?",#GER_YNCkind,>DOITTags:GER_Gadgets,DOITTEXT|Tag_done,Null)
If Result=#GER_No {
Close(FH)
FH=Open(#Buffer,#Mode_new)
}
If Result=#GER_Cancel {
{* Flush *}
Close(FH)
Copymem("Base-CD:\$00",#Dirname,?)
Copymem(".index\$00",#Filename,?)
FileReq(0)
{* Flush *}
FH=Open(#Name_bak,#Mode_new)
}
{* Flush *}
Seek(FH,0,#Offset_end)
RTS
EinScannen[]:
IndexWindow=OpenGuiWindowA(000,011,640,255,"CD-Finder Directoryindex",
#IDCMP_GADGETDOWN!IDCMP_GADGETUP!IDCMP_CLOSEWINDOW!IDCMP_IDCMPupdate,
#WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_RMBTRAP!0,0,0)
Checkf IndexWindow,.ende
IndexGUI=CreateGuiInfoA(IndexWindow,0)
NewObject=NewDTObjectA(#Buffer,>NewDTTAGS:GA_Left,5|GA_TOP,11|
GA_Width,630|GA_Height,248|
GA_ID,1|
ICA_Target,ICTARGET_IDCMP|
Tag_done,Null)
AddDTObject(IndexWindow,0,NewObject,-1)
.WaitMessage:
{* Flush *}
WaitGuiMsg(IndexGui)
MsgClass=.l36(IndexGui)
MsgGadNbr=.w52(IndexGui)
MsgChar=.b43(IndexGui)
If MsgClass=#IDCMP_IDCMPUpdate {
RefreshDTObjectA(NewObject,IndexWindow,0,0)
Bra .WaitMessage
}
If MsgClass##IDCMP_CloseWindow --> .WaitMessage
{* Flush *}
RemoveDTObject(IndexWindow,NewObject)
DisposeDTObject(NewObject)
CloseGuiWindow(IndexWindow)
.ende:
RTS
Start:
STATUS==1
OO==0
IF (TH=Open("Env:Cd-Finder.dat",#Mode_old))##0 {
Read(TH,#Status,4)
Read(TH,#Searchonly,4)
Close(TH)
}
OH=Open("Kcon://640/200/CD-Finder/AUTO/CLOSE/WAIT",#mode_old)
If OH=#0 {
OO==1
OH=Output()
}
CD("Base-CD:")
CopyMem("CD0:",#Device,?)
Jsr Open_Window
CheckF Window,PRG_Ende
Jsr Create_Gadgets
CheckF Result,WaitMessage
GuiRequestA(Gui,"GadgetError!",#GER_OKKind,#OKTAGS)
Bra PRG_Ende
WaitMessage:
WaitGuiMsg(Gui)
MsgClass=.l36(Gui)
MsgGadNbr=.w52(Gui)
If MsgClass=#IDCMP_CloseWindow --> PRG_Ende
If MsgClass##IDCMP_GadgetUp -----> WaitMessage
GuiGadgetActiona(Gui,>Gettags:GEG_GetVar,GEG_Allgadgets|
Tag_done,Null)
If MsgGadNbr=#1 {
Files==0
Dirs==0
Counter==0
Merker==0
Progress(6,0)
GetCDName(#Device)
Buffer=="Die CD heißt: "+CDName
GuiRequestA(Gui,#buffer,#GER_Okkind,>OKTags:GER_Gadgets,OKTEXT="Weiter"|Tag_Done,Null)
OK=Countstring(#CDName)
Buffer=="Base-CD:"+Left$(CDName,ok)+".Index"
FH=Open(#Buffer,#mode_old)
If FH##0 {
Anhaengen()
}
If FH=#0 {
FH=Open(#Buffer,#Mode_new)
}
CD(#Device)
CDlock=Lock(#Device,#Access_read)
CheckF CDLock,CantLock
Move.l a7,a5
.Schleife:
{* Flush *}
OK=Examine(CDLock,#FIB)
CheckF FH,CDENDEError
.Schleife1:
{* Flush *}
OK=ExNext(CDLock,#FIB)
CheckF OK,.dirende
Progressreadlines()
Type=.l4(#FIB)
If Type>#0 --> .dir
Zeiger=8(#FIB)
Filelock=Lock(Zeiger,#Access_read)
NameFromLock(Filelock,#Buffer,100)
Unlock(Filelock)
OK=Countstring(#Buffer)
If Status=#0 --> .skippy
Copymem(#Buffer,#SuchText,100)
GuiGadgetActiona(Gui,>Settags:GEG_SetVar,GEG_Allgadgets|
Tag_done,Null)
.skippy:
{* Flush *}
Files==Files++
Write(FH,#Buffer,ok)
Write(FH,"\n",1)
Bra .Schleife1
.dir:
{* Flush *}
Counter==Counter-1
Zeiger=8(#FIB)
Dummy=Lock(Zeiger,#Access_read)
Move.l Dummy,-(a7)
Dirs==Dirs++
Bra .Schleife1
.dirende:
{* Flush *}
Cmp.l a5,a7
Beq .dirende1
Unlock(CDLock)
Move.l (a7)+,CDLOCK
l=Currentdir(CDLOCK)
unlock(l)
FillBuffer(#FIB,0,300)
bra .Schleife
.dirende1:
{* Flush *}
Close(FH)
Progress(6,50)
FillBuffer(#SuchText,0,100)
GuiGadgetActiona(Gui,#Settags)
Counter==Files
Convertzahl(Files,0)
Move.l Zusatz,Files1
Move.l Zahl,Files
Convertzahl(Dirs,0)
Move.l Zusatz,Dirs1
Move.l Zahl,Dirs
CD("Base-CD:")
OK=Countstring(#CDName)
Buffer=="Base-CD:"+Left$(CDName,ok)+".Index"
Crunch(#Buffer)
Buffer=="Es sind "+Left$(Files,5)+" Files und "+Left$(Dirs,5)+" Dirs in "+CDName
GuiRequestA(GUi,#Buffer,#GER_okkind,#OKTAGS)
bra WaitMessage
}
If MsgGadNbr=#2 {
Progress(6,0)
GetCDName(#Device)
OK=Countstring(#CDName)
Buffer=="Base-CD:"+Left$(CDName,ok)+".Index"
FH=Open(#Buffer,#Mode_old)
Decrunch(#FH)
If FH##0 {
Found==0
FileReq(0)
CheckF Result,.close2
Filelock=Lock(#name_bak,#Access_Read)
NameFromLock(Filelock,#Buffer+2,300)
Unlock(Filelock)
OK=CountString(#Buffer+2)
lea Buffer,a0
Move.w #"#?",(a0)+
add.l ok,a0
Move.w #"#?",(a0)+
WH=Open("T:Swap",#Mode_New)
IsWild=ParsePatternNoCase(#Buffer,#FIB,300)
bra .SchleifeY
.SchleifeX:
Fputs(WH,#Buffer)
.SchleifeY:
Result=Fgets(FH,#Buffer,1000)
If Result##Buffer --> .close2
Match=MatchPatternNoCase(#FIB,#Buffer)
CheckF Match,.SchleifeX
Found==1
Bra .SchleifeY
.close2:
Close(WH)
Close(FH)
Progress(6,50)
If Found=#1 {
OK=Countstring(#CDName)
Buffer=="Base-CD:"+Left$(CDName,ok)+".Index"
FH=Open("T:Swap",#Mode_old)
WH=Open(#buffer,#Mode_new)
Copy(FH,WH)
Close(WH)
Close(FH)
OK=Countstring(#CDName)
Buffer=="Base-CD:"+Left$(CDName,ok)+".Index"
Crunch(#Buffer)
}
Progress(5,100)
}
}
If MsgGadNbr=#3 {
Progress(6,0)
Counter==0
Files==0
Merker==0
Dirs==0
Treffer==0
Index=GetIndex()
CopyMem(#Suchtext,#Buffer+2,100)
OK=CountString(#Buffer+2)
Lea Buffer,a0
Move.w #"#?",(a0)+
Add.l ok,a0
Move.w #"#?",(a0)+
IsWild=ParsePatternNoCase(#buffer,#SuchText,100)
If Searchonly##0 {
Copymem("Base-CD:\$00",#Dirname,?)
Copymem("\$00",#Filename,?)
FileReq(0)
Zeiger==#Name_Bak
Index==1
bra .in
}
Dirlock=Lock("Base-CD:",#access_read)
FillBuffer(#Fib,0,300)
Examine(Dirlock,#FIB)
.SchleifeZ1:
If searchonly##0 --> .close4a
OK=ExNext(Dirlock,#FIB)
CheckF Ok,.close4
Zeiger=8(#Fib)
.in:
Dirs==Dirs++
Pro==Dirs*100
Pro==Pro/Index
Progress(6,Pro)
FH=Open(Zeiger,#Mode_Old)
Decrunch(#FH)
If (Zeiger=TestFilename(Fh,"T:swap.decrunch"))##0 --> .SchleifeZ2
.SchleifeZ:
Result=Fgets(FH,#Buffer,1000)
If Result##Buffer --> .close3
ProgressFiles()
Match=MatchPatternNoCase(#SuchText,#Buffer)
CheckF Match,.SchleifeZ
Treffer==Treffer++
OK=Countstring(#Buffer)
Write(Oh,#Buffer,OK)
bra .SchleifeZ
.SchleifeZ3:
OK=Countstring(Zeiger)
Zeiger==Zeiger+OK
Zeiger==Zeiger++
.SchleifeZ2:
Result=Rgets(Zeiger)
If Result=#0 --> .close3a
ProgressFiles()
Match=MatchPatternNoCase(#SuchText,Zeiger)
CheckF Match,.SchleifeZ3
Treffer==Treffer++
OK=Countstring(Zeiger)
Write(Oh,Zeiger,OK)
Write(Oh,"\n",1)
Zeiger==Zeiger+OK
Zeiger==Zeiger++
bra .SchleifeZ2
.close3a:
Freemem(Memoryblock,laenge)
.close3:
NamefromFH(FH,#Buffer,1000)
Filepointer=FilePart(#Buffer)
Match=Comparestring(FilePointer,"swap.decrunch",0,#Mode_Nocase)
If Match##0 --> .close6
Close(FH)
bra .Schleifez1
.close6:
Close(FH)
Deletefile(#Buffer)
bra .Schleifez1
.close4:
Unlock(Dirlock)
.Close4a: Convertzahl(Treffer,OH)
Write(OH," Treffer in ",?)
Convertzahl(Counter,OH)
Write(OH," Einträgen durchsucht auf ",?)
Convertzahl(Index,OH)
Write(OH," CD's!\n",?)
Progress(6,100)
}
If MsgGadNbr=#5 {
Progress(6,0)
FileReq(0)
CheckF Result,WaitMessage
FH=Open(#name_bak,#Mode_old)
CheckF FH,WaitMessage
OK=CountString(#Name)
Buffer=="Base-CD:"+Left$(Name,ok)+".Index"
WH=Open(#Buffer,#Mode_NEW)
CheckF WH,.Close5
OK=AminetCheck(FH)
Checkf Ok,.close5
Copy(FH,WH)
.close5:
Close(FH)
Close(WH)
Buffer=="Base-CD:"+Left$(Name,ok)+".Index"
Crunch(#buffer)
Progress(6,100)
}
If MsgGadNbr=#8 {
Progress(6,0)
Copymem("Base-CD:\$00",#Dirname,?)
Copymem(".Index\$00",#Filename,?)
FileReq(0)
CheckF Result,WaitMessage
FH=Open(#Name_bak,#Mode_old)
CheckF FH,WaitMessage
Decrunch(#FH)
NamefromFH(fh,#Buffer,1000)
Close(FH)
EinScannen()
DeleteFile(#Buffer)
Progress(6,100)
}
If MsgGadNbr=#9 {
Progress(6,0)
Copymem("Base-CD:",#Dirname,?)
Copymem(".Index\$00",#name,?)
FileReq(0)
CheckF Result,WaitMessage
FH=Open(#Name_bak,#Mode_old)
CheckF FH,WaitMessage
Seek(FH,0,#Offset_end)
Laenge=Seek(FH,0,#Offset_begin)
Decrunch(#FH)
NamefromFH(fh,#Buffer,1000)
Seek(FH,0,#Offset_end)
Laenge2=Seek(FH,0,#Offset_begin)
Close(FH)
DeleteFile(#Buffer)
IndexWindow=OpenGuiWindowA(000,011,300,110,"CD-Finder Status",
#IDCMP_GADGETDOWN!IDCMP_GADGETUP!IDCMP_CLOSEWINDOW!IDCMP_IDCMPupdate,
#WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_RMBTRAP!0,0,0)
Checkf IndexWindow,WaitMessage
IndexGUI=CreateGuiInfoA(IndexWindow,0)
OK=Countstring(#name)
OK==OK-6
OK==OK+#name
Copymem("\$00",OK,1)
Convertzahl(Laenge,0)
Copymem(#zusatz,#gepackt_txt,8)
Copymem(" Bytes",#gepackt_Txt+8,?)
Convertzahl(Countfiles,0)
Copymem(#zusatz,#Files_txt,8)
Copymem(" Stück",#Files_Txt+8,?)
Convertzahl(CountDirs,0)
Copymem(#zusatz,#Dirs_txt,8)
Copymem(" Stück",#Dirs_Txt+8,?)
Convertzahl(Laenge2,0)
Copymem(#zusatz,#ungepackt_txt,8)
Copymem(" Bytes",#ungepackt_Txt+8,?)
Laenge==Laenge*100
Laenge==Laenge/Laenge2
Convertzahl(Laenge,0)
Copymem(" ",#Ratio_txt,?)
Copymem(#zahl+1,#ratio_txt+5,3)
Copymem("%",#Ratio_Txt+9,?)
CreateGuiGadgetA(IndexGui,90,10,200,013,#Text_Kind,
>GadgetI00Tags:GEG_Description,0|
GTTX_Border,1|
GEG_Text,GadgetI00Text="Volumen:"|
GTTX_Text,name|
Tag_done,0)
CreateGuiGadgetA(IndexGui,90,40,200,013,#Text_Kind,
>GadgetI01Tags:GEG_Description,0|
GTTX_Border,1|
GEG_Text,GadgetI01Text="Gepackt:"|
GTTX_Text,gepackt_txt|
Tag_done,0)
{* Incblock: gepackt_TXT,100*}
CreateGuiGadgetA(IndexGui,90,25,200,013,#Text_Kind,
>GadgetI02Tags:GEG_Description,0|
GTTX_Border,1|
GEG_Text,GadgetI02Text="Ungepackt:"|
GTTX_Text,ungepackt_txt|
Tag_done,0)
{* Incblock: ungepackt_TXT,100*}
CreateGuiGadgetA(IndexGui,90,55,200,013,#Text_Kind,
>GadgetI03Tags:GEG_Description,0|
GTTX_Border,1|
GEG_Text,GadgetI03Text="Ratio:"|
GTTX_Text,Ratio_txt|
Tag_done,0)
{* Incblock: Ratio_TXT,100*}
CreateGuiGadgetA(IndexGui,90,70,200,013,#Text_Kind,
>GadgetI04Tags:GEG_Description,0|
GTTX_Border,1|
GEG_Text,GadgetI04Text="Files:"|
GTTX_Text,Files_txt|
Tag_done,0)
{* Incblock: Files_TXT,100*}
CreateGuiGadgetA(IndexGui,90,85,200,013,#Text_Kind,
>GadgetI05Tags:GEG_Description,0|
GTTX_Border,1|
GEG_Text,GadgetI05Text="Dirs:"|
GTTX_Text,Dirs_txt|
Tag_done,0)
{* Incblock: Dirs_TXT,100*}
DrawGuiA(IndexGui,0)
Progress(6,100)
CloseGuiWindow(IndexWindow)
}
If MsgGadNbr=#10 {
Progress(6,0)
IndexWindow=OpenGuiWindowA(000,011,640,200,"CD-Finder Export",
#IDCMP_GADGETDOWN!IDCMP_GADGETUP!IDCMP_CLOSEWINDOW!IDCMP_REFRESHWINDOW!IDCMP_VANILLAKEY!IDCMP_MOUSEBUTTONS,
#WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_RMBTRAP!0,0,0)
Checkf IndexWindow,WaitMessage
SelectedNodeZeiger==#SelectedNodespeicher
Jsr Indexliste_erstellen
{* Flush *}
IndexGUI=CreateGuiInfoA(IndexWindow,0)
CreateGuiGadgetA(IndexGui,10,115,200,015,#String_Kind,
>GadgetE00Tags:GEG_Description,0|
GEG_Flags,016|
GEG_Varaddress,IndexItem|
Tag_done,0)
{* IncSysBlock: IndexItem,100*}
GuiGadgetinfo100=GetGuiGadgetA(IndexGui,000,#GEG_Address)
lea GadgetE01tags,a0
4(a0)==GuiGadgetInfo100
CreateGuiGadgetA(IndexGui,010,015,200,0100,#Listview_Kind,
>GadgetE01Tags:
GTLV_ShowSelected,GuiGadgetinfo100|
GEG_Description,0|
GEG_Text,GADGETE01Text="Indexfiles:"|
GEG_Flags,004|
GEG_Varaddress,LV_Index|
GTLV_Labels,Index_Labs|
Tag_done,0)
{* Incvar: LV_index,Lv_Selected*}
CreateGuiGadgetA(IndexGui,250,115,200,015,#String_Kind,
>GadgetE02Tags:GEG_Description,0|
GEG_Flags,016|
GEG_Varaddress,SelectedItem|
Tag_done,0)
{* IncSysBlock: SelectedItem,100*}
GuiGadgetinfo101=GetGuiGadgetA(IndexGui,002,#GEG_Address)
lea GadgetE03tags,a0
4(a0)==GuiGadgetInfo101
CreateGuiGadgetA(IndexGui,250,015,200,0100,#Listview_Kind,
>GadgetE03Tags:
GTLV_ShowSelected,GuiGadgetinfo100|
GEG_Description,0|
GEG_Text,GADGETE03Text="Selected"|
GEG_Flags,004|
GEG_Varaddress,LV_Selected|
GTLV_Labels,Selected_Labs|
Tag_done,0)
CreateGuiGadgetA(IndexGui,070,120,160,013,#Cycle_Kind,
>GadgetE04Tags:GEG_Description,0|
GEG_Text,GADGETE04Text="_Output:"|
GEG_Flags,001|
GEG_Varaddress,CYCLE_Index|
GTCY_Labels,Cycle_Labs|
Tag_done,0)
{* IncVar: Cycle_index*}
CreateGuiGadgetA(IndexGui,230,120,200,013,#String_Kind,
>GadgetE05Tags:GEG_Description,0|
GEG_Varaddress,Name_bak|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(IndexGui,430,120,040,013,#Button_Kind,
>GadgetE06Tags:GEG_Description,0|
GEG_Text,GADGETE06Text="_REQ"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(IndexGui,470,120,160,013,#Cycle_Kind,
>GadgetE07Tags:GEG_Description,0|
GEG_Text,GADGETE07Text="Dateityp:"|
GEG_Flags,004|
GEG_Varaddress,Type_Index|
GTCY_Labels,DateiType_Labs|
Tag_done,0)
{* IncVar: Type_index*}
CreateGuiGadgetA(IndexGui,210,40,040,015,#Button_Kind,
>GadgetE08Tags:GEG_Description,0|
GEG_Text,GADGETE08Text=" --> "|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(IndexGui,210,55,040,015,#Button_Kind,
>GadgetE09Tags:GEG_Description,0|
GEG_Text,GADGETE09Text=" <-- "|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(IndexGui,10,135,100,013,#Button_Kind,
>GadgetE10Tags:GEG_Description,0|
GEG_Text,GADGETE10Text="_Export"|
GEG_Flags,016|
Tag_done,0)
CreateGuiGadgetA(IndexGui,120,138,240,06,#GEG_ProgressIndicatorKind,
>GadgetE11Tags:GEG_Description,0|
GEG_Flags,016|
Tag_done,0)
DrawGuiA(IndexGui,0)
.WaitMessage1:
{* Flush *}
WaitGuiMsg(IndexGui)
MsgClass=.l36(IndexGui)
MsgCode=.w40(IndexGui)
MsgGadNbr=.w52(IndexGui)
If MsgClass=#IDCMP_CloseWindow --> .CloseWindow
GuigadgetActiona(IndexGui,#GetTags)
If MsgGadnbr=#6 {
Copymem("Turbocalc:",#Dirname,?)
Copymem(".index\$00",#Filename,?)
FileReq(0)
CheckF Result,.WaitMessage1
GuiGadgetActiona(IndexGui,>Set5tag:GEG_SetVar,5|Tag_done,Null)
}
If MsgGadNbr=#8 {
move.l LV_Index,d0
Swap D0
Andi.l #$FFFF,d0
mulu.l #4,d0
move.l d0,a0
add.l #IndexItems,a0
move.l Selectednodezeiger,a5
Move.l (a0),10(a5)
Addtail(#Selected_labs,a5)
Lea 14(a5),a5
Move.l a5,Selectednodezeiger
SetGuiGadgetA(IndexGui,3,>SetNewItem:GTLV_Labels,Selected_Labs|Tag_done,Null)
}
If MsgGadNbr=#9 {
Node=FindName(#Selected_labs,#SelectedItem)
Zeiger=.l10(Node)
Remove(Node)
FreeMem(Zeiger,108)
SelectedNodeZeiger==SelectedNodeZeiger-14
FillBuffer(SelectedNodeZeiger,0,14)
SetGuiGadgetA(IndexGui,3,#SetNewItem)
}
bra .WaitMessage1
.Closewindow:
jsr Remove_Indexliste
jsr Remove_Selectedliste
{* Flush *}
CloseGuiWindow(IndexWindow)
Progress(6,100)
}
WaitMessage1:
If MsgGadNbr=#12 {
Prefs()
}
Bra WaitMessage
CDENDEError:
Unlock(CDlock)
GUIRequestA(Gui,"Konnte kein Indexfile anlegen!",#GER_Okkind,#OKTAGS)
Bra WaitMessage
CantLock:
GUIRequestA(Gui,"Device nicht gefunden, bitte CD einlegen!",#GER_Okkind,#OKTAGS)
Bra WaitMessage
PRG_Ende:
If Window##0 {
jsr Close_window
}
CD("Progdir:")
IF OO=#0 do Close(OH)
IF (TH=Open("Env:Cd-Finder.dat",#Mode_old))##0 {
Write(TH,#Status,4)
Write(TH,#Searchonly,4)
Close(TH)
}
RTS
IndexListe_erstellen:
Dirlock=Lock("Base-CD:",#Access_read)
FillBuffer(#Fib,0,300)
Examine(Dirlock,#FIB)
lea IndexItems,a4
.Schleife:
{* Flush *}
OK=Exnext(Dirlock,#FIB)
CheckF OK,.dirende
Type=.l4(#FIB)
If Type>#0 --> .Schleife
Zeiger=8(#FIB)
Memoryblock=AllocMem(108,#MEMF_public)
Checkf Memoryblock,.dirende
move.l memoryblock,(a4)+
Copymem(Zeiger,Memoryblock,108)
bra .Schleife
.Dirende:
Unlock(Dirlock)
lea IndexItems,a4
lea IndexNodespeicher,a5
.node1:
Checkf (a4),.node2
move.l (a4)+,10(a5)
Addtail(#Index_labs,a5)
lea 14(a5),a5
bra .node1
.node2:
Move.l a5,Indexnodezeiger
RTS
Remove_SelectedListe:
Node=RemTail(#Selected_Labs)
CheckT Node,Remove_SelectedListe
FillBuffer(#Selectednodespeicher,0,5024)
RTS
Remove_IndexListe:
Node=RemTail(#Index_Labs)
CheckT Node,Remove_IndexListe
move.l #IndexItems,a5
.l1:move.l (a5)+,a1
cmpi.l #0,a1
beq .ende
Freemem(a1,108)
bra .l1
.ende:
FillBuffer(#Indexnodespeicher,0,5024)
FillBuffer(#IndexItems,0,1024)
RTS
Readin[]:
Copymem("Base-CD:",#Dirname,?)
FileReq(0)
FH=Open(#name_bak,#Mode_old)
CheckF FH,.error
WH=Open("T:DirTree.temp",#Mode_new)
CheckF WH,.error1
.l1:
Result=Fgets(FH,#Pfad,150)
If Result##Pfad -> .ende
cmpi.l #"CM01",pfad
beq .l1
cmpi.b #"%",pfad
beq .l1
Pathpart(#pfad)
move.l d0,a0
move.w #$0000,(a0)
OK=Countstring(#pfad)
OK==OK+1
Write(WH,#Pfad,OK)
; Write(wh,"\n",1)
bra .l1
.ende:
Close(WH)
Close(FH)
FH=Open("T:DirTree.temp",#Mode_Old)
CheckF FH,.error
Seek(FH,0,#Offset_end)
Len=Seek(FH,0,#Offset_begin)
Memoryblock=AllocMem(Len,#MEMF_Public)
CheckF memoryblock,.error1
Read(FH,Memoryblock,len)
Close(FH)
Deletefile("T:Dirtree.temp")
move.l Memoryblock,d0
move.l Len,d1
RTS
.error1:
{* Flush *}
Close(FH)
.error:
moveq.l #0,d0
RTS
EntryLevel[a0,d1]:
movem.l a2-a6/d0-d7,-(a7)
moveq.l #0,d0
.count:
addq.l #1,d0
cmpi.l d0,d1
beq .write
lea 1(a0),a0
.CountCells1:
cmpi.b #0,(a0)
beq .ERROR
cmpi.b #`:`,(a0)
beq .count
cmpi.b #`/`,(a0)
beq .Count
lea 1(a0),a0
bne .CountCells1
.Write:
cmpi.l #1,d1
beq .write0
lea 1(a0),a0
.write0:
move.l a0,a1
.weiter:
cmpi.b #`:`,(a0)
beq .next
cmpi.b #`/`,(a0)
beq .next
cmpi.b #$0a,(a0)
beq .next
cmpi.b #$00,(a0)
beq .next
lea 1(a0),a0
bra .weiter
.next:
sub.l a1,a0
movem.l (a7)+,a2-a6/d0-d7
RTS
.error:
move.l #0,a0
move.l #0,a1
bra .next
DrawTree_Lines[A2]:
move.l (a2),a1
OK=Countstring(a1)
move.l 4(a2),A1
cmpi.l #0,a1
beq .l1
move.l a2,-(a7)
move.l von,-(a7)
jsr Write_line_Sub
DrawTree_Lines(A1)
move.l (a7)+,von
move.l (a7)+,a2
.l1:
move.l 8(a2),A1
cmpi.l #0,a1
beq .l2
jsr Write_line_next
Move.l a1,a2
bra DrawTree_Lines
.l2: ; Stack: 09080706050403020100
RTS
Write_line_Sub:
move.l 28(a2),Von
move.l 28(a1),Bis
movem.l a0-a1,-(a7)
Write(FH,#von,4)
Write(FH,#Bis,4)
movem.l (a7)+,a0-a1
RTS
Write_line_Next:
move.l 28(a1),Bis
movem.l a0-a1,-(a7)
Write(FH,#von,4)
Write(FH,#Bis,4)
movem.l (a7)+,a0-a1
RTS
DrawTree_Punkte[A2]:
For I=0 to Entries
Lines==0
Drawtree_Sub(Tree)
Write(FH,#X,4)
Write(FH,#Y,4)
Write(FH,#Z,4)
Write(FH,namenzeiger,20)
Next I
RTS
DrawTree_Sub:
{* Incvar: Namenzeiger*}
Lines==Lines+1
move.l (a2),a1
OK=Countstring(a1)
move.l 28(a2),d0
cmpi.l I,d0
bne .l0
move.l 0(a2),Namenzeiger
move.l 16(a2),X
move.l 20(a2),Y
move.l 24(a2),Z
RTS
.l0:move.l 4(a2),A1
cmpi.l #0,a1
beq .l1
move.l a2,-(a7)
DrawTree_SUB(A1)
move.l (a7)+,a2
.l1:
move.l 8(a2),A1
cmpi.l #0,a1
beq .l2
move.l a2,-(a7)
DrawTree_SUB(A1)
move.l (a7)+,a2
.l2:
RTS
Deep[a2]:
movem.l a0-a6,-(a7)
For I=1 to 255
Entrylevel(a2,I)
cmpi.l #0,a0
beq .ende
Next I
.ende:
I==I--
movem.l (a7)+,a0-a6
move.l I,d0
RTS
Entry[Tree,a5]:
move.l #0,Y
Bis=Deep(a5)
Copymem(Tree,#Eintrag,#Eintraglaenge)
Move.l Tree,Adresse
For I=1 to Bis
move.l #0,X
EntryLevel(a5,I)
Movem.l a0-a1,-(a7)
Fillbuffer(#buffer,0,100)
Movem.l (a7)+,a2-a3
Copymem(a3,#Buffer,a2)
Addi.l #1,a2
Move.l I,d0
Muls.l #50,d0
Move.l d0,Z
.again:
If Char=#0 {
Mem1=AllocMem(a2,#Memf_Public)
CheckF mem1,.error
Copymem(#Buffer,mem1,a2)
move.l mem1,char
Copymem(#Eintrag,Adresse,#Eintraglaenge)
bra .found
}
OK=ComparePfad(Char,#Buffer)
Checkt OK,.found
If next=#0 {
Entries==Entries+1
Mem=Allocmem(#Eintraglaenge,#Memf_public)
CheckF mem,.error
Mem1=AllocMem(a2,#Memf_Public)
CheckF mem1,.error2
Move.l mem,a0
Move.l MEM1,(a0)+
Move.l #0,(a0)+
Move.l #0,(a0)+
Move.l Adresse,(a0)+
Move.l X,d0
Add.l #50,d0
Move.l d0,(a0)+
Move.l Y,d0
Add.l #50,d0
Move.l d0,(a0)+
Move.l Z,(a0)+
Move.l Entries,(a0)+
Move.l Mem,Next
CopyMem(a3,mem1,a2)
move.l mem1,a0
add.l a2,a0
move.b #0,-1(a0)
Copymem(#Eintrag,Adresse,#Eintraglaenge)
move.l next,Adresse
CopyMem(Next,#Eintrag,#Eintraglaenge)
Move.l X,d0
add.l #50,d0
move.l d0,X
Move.l Y,d0
add.l #50,d0
move.l d0,Y
bra .found
}
move.l next,Adresse
CopyMem(Next,#Eintrag,#Eintraglaenge)
bra .Again
.found:
IF I=Bis --> .tonext
If Sub=#0 {
Entries==Entries+1
Mem=Allocmem(#Eintraglaenge,#Memf_public)
CheckF mem,.error
move.l mem,a0
move.l #0,(a0)+
move.l #0,(a0)+
move.l #0,(a0)+
Move.l Adresse,(a0)+
move.l X,(a0)+
Move.l Y,(a0)+
Move.l Z,(a0)+
Move.l Entries,(a0)+
move.l mem,Sub
Copymem(#Eintrag,Adresse,#Eintraglaenge)
}
move.l sub,Adresse
Copymem(Sub,#Eintrag,#Eintraglaenge)
.tonext:
Next I
RTS
.error2:
FreeMem(mem,#Eintraglaenge)
.error:
move.l #0,d0
RTS
DrawTree[a2]:
move.l (a2),a1
OK=Countstring(a1)
move.l 16(a2),X
move.l 20(a2),Y
move.l 24(a2),Z
Write(Oh,a1,ok)
Write(oh,":X=",3)
Convertzahl(X,OH)
Write(oh,":Y=",3)
Convertzahl(Y,OH)
Write(oh,":Z=",3)
Convertzahl(Z,OH)
Write(oh,"\n",1)
move.l 4(a2),A1
cmpi.l #0,a1
beq .l1
move.l a2,-(a7)
DrawTree(A1)
move.l (a7)+,a2
.l1:
move.l 8(a2),A1
cmpi.l #0,a1
beq .l2
move.l a2,-(a7)
DrawTree(A1)
move.l (a7)+,a2
.l2:
RTS
BuildTree[]:
Entries==1
Zeiger==Memoryblock
Fillbuffer(#buffer,0,100)
OK=Entry(Tree,Zeiger)
Checkf OK,.ende
.Schleife:
Zeiger=Rgets2(Zeiger)
If Zeiger=#0 --> .ende
OK=Entry(Tree,Zeiger)
Checkf OK,.ende
bra .Schleife
.ende:
RTS
MakeTree[]:
move.l #0,Char
move.l #0,Sub
move.l #0,Next
move.l #0,Last
move.l #0,X
move.l #0,Y
move.l #0,Z
move.l #1,EntryNr
Zeiger=Allocmem(#Eintraglaenge,#Memf_Public)
Checkf Zeiger,.error
Copymem(#Eintrag,Zeiger,#Eintraglaenge)
move.l Zeiger,d0
RTS
.error:
{* Returnq 0*}
KillTree[a2]:
move.l 4(a2),A1
cmpi.l #0,a1
beq .l1
move.l a2,-(a7)
KillTree(A1)
move.l (a7)+,a2
.l1:
move.l 8(a2),A1
cmpi.l #0,a1
beq .l2
move.l a2,-(a7)
KillTree(A1)
move.l (a7)+,a2
.l2:
move.l (a2),a1
OK=Countstring(a1)
checkf Ok,.l3
OK==OK+1
freemem(a1,ok)
.l3:
{* Flush *}
freemem(a2,#Eintraglaenge)
RTS
Eintrag:
Char: dc.l 0 ; Zeiger auf String Nullterminiert
Sub: dc.l 0 ; Zeiger auf Subdir
Next: dc.l 0 ; Zeiger auf NextEntry
Last: dc.l 0 ; Zeiger auf PrevEntry
X: dc.l 0 ;
Y: dc.l 0 ; 3d - Koordinate
Z: dc.l 0 ;
EntryNr:dc.l 0 ; PunktNummer
Message:
dc.l 0
dc.l 0
dc.b 5,0
dc.l 0
dc.l 0
dc.w 0